'use strict';

define(function(){
	var templator = function(template,options){
		var exg = /{{\w*}}/;
		var digExg = /[\d]\d*/
		for(var key in options){
			if(key.match(digExg)){
				template = template.replace(exg,options[key]);
			}
			else{
				template = template.replace('{{' + key + '}}', options[key]);
			}
		}
		return template;
	};

	var Templator = function(template){
		this.template = template;
	};

	Templator.prototype.create = function(name,options){
		return templator(this.template[name],options);
	};

	return Templator;
});